<template>
  <div>
    <div v-for="(item, index) in itemArr" :key="index" @click="clickHouse(item)">
      <div class="content">
        <image :src="item.img" class="tu"></image>
        <div class="brief">
          <div class="title">
            {{ item.title }}
          </div>
          <div class="area" v-if="item.area">
            {{ item.area }}
          </div>
          <div class="area" v-if="item.other">
            {{ item.other }}
          </div>

          <div class="" v-if="item.isFull == 1">
            <div v-if="noLable">
              <ColorfulLabel :labelArr="item.label"></ColorfulLabel>
            </div>
            <div class="pricebox" v-if="item.price || item.total">
              <div class="total" v-if="item.price">
                <span class="priceLeft" v-if="item.priceLeft">{{ item.priceLeft }}</span>
                <text>{{ item.price }}</text>
                <span class="priceRight">{{ item.priceRight }}</span>
              </div>
              <div class="price" v-if="item.total">
                {{ item.total }}
              </div>
            </div>
          </div>

          <!-- 完善信息 -->
          <div class="complete" v-if="item.isFull == 0">完善信息</div>
        </div>
        <div class="rightHeader" v-if="rightHeader">
          <image src="https://fangguaner.wm76.mtnet.ren/static/applet/image/heart.png" mode="widthFix" />
        </div>
      </div>

      <div
        class="questionnaire"
        v-if="index == questionnaireIndex && questionnaire"
      >
        <div class="questionnaireBox">
          <image src="https://fangguaner.wm76.mtnet.ren/static/applet/image/newhousebg.png" mode="widthFix" />
          <div class="title">这次买房属于</div>
          <div class="title2">我们将根据您的需求，找到更适合您的楼盘</div>
          <div class="content">
            <div
              class="item"
              v-for="(v, i) in 6"
              :key="i"
              :style="i == 1 || i == 4 ? 'margin: 0 50rpx;' : ''"
            >
              刚需
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { selectTag } from "../../utils/index";
import ColorfulLabel from '../ColorfulLabel/index.vue'
export default {
  props: {
    questionnaire: {
      type: Boolean,
      default: false,
    },
    questionnaireIndex: {
      type: Number,
    },
    rightHeader: {
      Boolean,
      default: false,
    },
    itemArr: {
      type: Array,
      default: [
        {
          img: "https://fangguaner.wm76.mtnet.ren/static/applet/image/tuceng42.png",
          title: "金地天府城 1室1厅",
          area: "2室2厅 / 83.7㎡ / 西 / 金地天府城",
          total: "10830/㎡",
          price: 230,
          priceRight: "万", //价格后面的单位
          isFull: 1,
        },
        {
          img: "https://fangguaner.wm76.mtnet.ren/static/applet/image/tuceng42.png",
          title: "金地天府城 1室1厅",
          area: "2室2厅 / 83.7㎡ / 西 / 金地天府城",
          total: "10830/㎡",
          price: 230,
          priceRight: "万",
          isFull: 1,
        },
      ],
    },
    //是否显示近地铁那几个标签
    noLable: {
      type: Boolean,
      default: true,
    },
  },
  components: {
    ColorfulLabel
  },
  data() {
    return {};
  },
  created() {
  },
  methods: {
    clickHouse(item) {
      this.$emit("clickHouse", item);
    },
  },
};
</script>

<style scoped lang="less">
.content {
  display: flex;
  margin-left: 20rpx;
  margin-bottom: 34rpx;
}

.tu {
  width: 208rpx;
  height: 169rpx;
  border-radius: 10rpx;
}

.content > .brief {
  margin-left: 35rpx;
  width: 400rpx;
}

.brief > .title {
  font-size: 28rpx;
  color: #282828;
  font-family: MicrosoftYaHei-Bold;
  font-weight: 700;
  font-stretch: normal;
}

.brief > .area {
  font-size: 22rpx;
  color: #878787;
  font-family: MicrosoftYaHei-Bold;
  margin-top: 10rpx;
}

.lablebox {
  display: flex;
  margin-top: 18rpx;
}

.labeone {
  width: 71rpx;
  height: 31rpx;
  text-align: center;
  line-height: 31rpx;
  border-radius: 16rpx;

  font-size: 18rpx;
  display: inline-block;
  // color: #D24959;
  // background-color: #ffdddc;
}

.labletwo {
  display: inline-block;
  width: 102rpx;
  height: 31rpx;
  text-align: center;
  line-height: 31rpx;
  border-radius: 16rpx;
  background-color: #ffefdc;
  font-size: 18rpx;
  color: #d88e35;
  margin-left: 7rpx;
}

.lablethree {
  display: inline-block;
  width: 102rpx;
  height: 31rpx;
  text-align: center;
  line-height: 31rpx;
  background-color: #dcf8ff;
  border-radius: 16rpx;
  font-size: 18rpx;
  color: #33b1d0;
  margin-left: 7rpx;
}

.pricebox {
  display: flex;
  margin-top: 10rpx;
  text-align: left;
  /* margin-right: 34rpx; */
}
.pricebox .priceRight{
  margin-top: 8rpx;
}

.total {
  color: #e13c35;
  font-size: 18rpx;
  font-family: MicrosoftYaHei;
  display: flex;
  align-items: center;
  .priceLeft {
    margin-right: 10rpx;
    font-family: MicrosoftYaHei;
    font-size: 18rpx;
    font-weight: normal;
    font-stretch: normal;
    color: #6f6f6f;
  }
}

.total > text {
  font-size: 30rpx;
  font-weight: 700;
  font-family: PingFang-SC-Heavy;
  margin-right: 10rpx;
}

.price {
  font-size: 20rpx;
  font-family: MicrosoftYaHei;
  color: #666666;
  margin-left: 34rpx;
  margin-top: 12rpx;
}

/* 完善信息 */
.complete {
  width: 180rpx;
  height: 60rpx;
  line-height: 60rpx;
  text-align: center;
  border-radius: 30rpx;
  background-color: #f75653;
  font-size: 26rpx;
  color: #ffffff;
  margin-top: 32rpx;
}

.questionnaire {
  padding: 0 15rpx;
  margin-bottom: 30rpx;
  box-sizing: border-box;
  .questionnaireBox {
    height: 356rpx;
    background-color: #f1f1f1;
    border-radius: 10rpx;
    border: solid 1rpx #fef3b0;
    position: relative;
    image {
      width: 100%;
      height: 100%;
    }
    .title {
      font-family: MicrosoftYaHei-Bold;
      font-size: 30rpx;
      font-weight: bold;
      font-stretch: normal;
      letter-spacing: 0rpx;
      color: #000000;
      position: absolute;
      top: 51rpx;
      left: 37rpx;
    }
    .title2 {
      font-family: MicrosoftYaHei;
      font-size: 20rpx;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: 0rpx;
      color: #929292;
      position: absolute;
      top: 104rpx;
      left: 37rpx;
    }
    .content {
      width: 607rpx;
      height: 150rpx;
      position: absolute;
      left: 40rpx;
      bottom: 0rpx;
      // border: 1px solid red;
      display: flex;
      justify-content: space-between;
      align-content: space-between;
      flex-wrap: wrap;
      .item {
        width: 129rpx;
        height: 60rpx;
        background-color: #ffffff;
        border-radius: 10rpx;
        color: #a37d01;
        font-size: 24rpx;
        text-align: center;
        line-height: 60rpx;
      }
    }
  }
}

.rightHeader {
  width: 50rpx;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  image {
    width: 28prx;
    height: 28rpx;
  }
}
</style>